# Return formatted size of file
def sizeof_fmt(num):
    for unit in ['', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB']:
        if abs(num) < 1024.0:
            return "%3.1f%s" % (num, unit)
        num /= 1024.0
    return "%.1f%s" % (num, 'YB')


# Get current time, return as type of '2014-02-12 12:33'
def get_localtime():
    import time
    iso_time_format = "%Y-%m-%d %H:%M"
    return time.strftime(iso_time_format, time.gmtime(time.time() + 28800))